<?php

use think\facade\Route;
use app\admin\middleware\LoginMiddleware;
use app\admin\middleware\AuthMiddleware;
use app\admin\middleware\OperationLog;

Route::group('auth', function () {

    Route::group('admin', function () {
        //管理员列表
        Route::get('lists', 'auth.Admin/lists');
        //添加管理员
        Route::post('add', 'auth.Admin/add');
        //编辑管理员
        Route::post('edit', 'auth.Admin/edit');
        //管理员详情
        Route::get('detail', 'auth.Admin/detail');
        //删除管理员
        Route::delete('delete', 'auth.Admin/delete');
        //获取当前管理员信息
        Route::get('mySelf', 'auth.Admin/mySelf');
        //编辑超级管理员信息
        Route::post('editSelf', 'auth.Admin/editSelf');
    });

    Route::group('menu', function () {
        //获取菜单路由
        Route::get('route', 'auth.Menu/route');
        //菜单列表
        Route::get('lists', 'auth.Menu/lists');
        //添加菜单
        Route::post('add', 'auth.Menu/add');
        //编辑菜单
        Route::post('edit', 'auth.Menu/edit');
        //菜单详情
        Route::get('detail', 'auth.Menu/detail');
        //删除菜单
        Route::delete('delete', 'auth.Menu/delete');
        //获取菜单数据
        Route::get('all', 'auth.Menu/all');
        //获取权限数据
        Route::get('auth', 'auth.Menu/auth');
    });

    Route::group('role', function () {
        //角色列表
        Route::get('lists', 'auth.Role/lists');
        //添加角色
        Route::post('add', 'auth.Role/add');
        //编辑角色
        Route::post('edit', 'auth.Role/edit');
        //角色详情
        Route::get('detail', 'auth.Role/detail');
        //删除角色
        Route::delete('delete', 'auth.Role/delete');
        //获取角色数据
        Route::get('all', 'auth.Role/all');
    });

    Route::group('dept', function () {
        //部门列表
        Route::get('lists', 'auth.Dept/lists');
        //添加部门
        Route::post('add', 'auth.Dept/add');
        //编辑部门
        Route::post('edit', 'auth.Dept/edit');
        //部门详情
        Route::get('detail', 'auth.Dept/detail');
        //删除部门
        Route::delete('delete', 'auth.Dept/delete');
        //获取部门数据
        Route::get('all', 'auth.Dept/all');
    });

    Route::group('jobs', function () {
        //岗位列表
        Route::get('lists', 'auth.Jobs/lists');
        //添加岗位
        Route::post('add', 'auth.Jobs/add');
        //编辑岗位
        Route::post('edit', 'auth.Jobs/edit');
        //岗位详情
        Route::get('detail', 'auth.Jobs/detail');
        //删除岗位
        Route::delete('delete', 'auth.Jobs/delete');
        //获取岗位数据
        Route::get('all', 'auth.Jobs/all');
    });

})->middleware([
    LoginMiddleware::class,
    AuthMiddleware::class,
    OperationLog::class
]);